package com.yx.cloud.bean.tuya;

public class RequestMapOperation<T> {
    private long mapId;
    private String operate;
    private T extra;

    private RequestMapOperation(Builder<T> builder) {
        setMapId(builder.mapId);
        setOperate(builder.operate);
        setExtra(builder.extra);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public long getMapId() {
        return mapId;
    }

    public void setMapId(long mapId) {
        this.mapId = mapId;
    }

    public String getOperate() {
        return operate;
    }

    public void setOperate(String operate) {
        this.operate = operate;
    }

    public T getExtra() {
        return extra;
    }

    public void setExtra(T extra) {
        this.extra = extra;
    }


    public static final class Builder<T> {
        private long mapId;
        private String operate;
        private T extra;

        private Builder() {
        }

        public Builder setMapId(long mapId) {
            this.mapId = mapId;
            return this;
        }

        public Builder setOperate(String operate) {
            this.operate = operate;
            return this;
        }

        public Builder setExtra(T extra) {
            this.extra = extra;
            return this;
        }

        public RequestMapOperation build() {
            return new RequestMapOperation(this);
        }
    }


    public static final String MAP_OPERATION_ROTATE="rotateMap";//extra : {"angle":30}
    public static class RotateMapExtra{
        private int angle;

        public int getAngle() {
            return angle;
        }

        public void setAngle(int angle) {
            this.angle = angle;
        }
    }

    public static final String MAP_OPERATION_CLEAR="clear";     //extra : null

    public static final String MAP_OPERATION_DELETE="delete";  //extra : {"type":"local", "mapId":12345678}
    public static class DeleteMapExtra{
        /**
         * type : local
         * mapId : 12345678
         */
        private String type;
        private long mapId;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public long getMapId() {
            return mapId;
        }

        public void setMapId(long mapId) {
            this.mapId = mapId;
        }
    }

    public static final String MAP_OPERATION_SAVE="save";       //extra : {"type":"local"}
    public static class SaveMapExtra{

        /**
         * type : local
         */

        private String type;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }
    }

    public static final String MAP_OPERATION_SETINFO="setMapInfo";  //extra :{"tag":"mapName", "mapId":12345678}
    public static class SetMapInfoExtra{
        /**
         * tag : mapName
         * mapId : 12345678
         */

        private String tag;
        private long mapId;

        public String getTag() {
            return tag;
        }

        public void setTag(String tag) {
            this.tag = tag;
        }

        public long getMapId() {
            return mapId;
        }

        public void setMapId(long mapId) {
            this.mapId = mapId;
        }
    }

    public static final String MAP_OPERATION_GETINFO="getMapsInfo";     //extra : null


    public static final String MAP_OPERATION_SETMAP="setMap";       //extra :{"type":"local", "mapId":12345678 }  or {"type":"server","downUrl":"xxxxx","md5":"xxxxxx"}
    public static class SetLocalMapExtra{

        /**
         * type : local
         * mapId : 12345678
         */

        private String type;
        private int mapId;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public int getMapId() {
            return mapId;
        }

        public void setMapId(int mapId) {
            this.mapId = mapId;
        }
    }

    public static class SetServerMapExtra{

        /**
         * type : server
         * downUrl : xxxxx
         * md5 : xxxxxx
         */

        private String type;
        private String downUrl;
        private String md5;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getDownUrl() {
            return downUrl;
        }

        public void setDownUrl(String downUrl) {
            this.downUrl = downUrl;
        }

        public String getMd5() {
            return md5;
        }

        public void setMd5(String md5) {
            this.md5 = md5;
        }
    }


}
